if BUILDOPT_INSTALL_TESTS
insttestdir=$(pkglibexecdir)/installed-tests
-testfiles = t0000-basic \
- t0001-archive \
- t0002-archivez \
- t0003-log \
- t0004-remote-add \
- t0005-corruption \
- t0006-libarchive \
- t0011-pull-archive-z \
- t0015-admin-deploy \
- t0016-admin-deploy \
+testfiles = test-basic \
+ test-archive \
+ test-archivez \
+ test-log \
+ test-remote-add \
+ test-corruption \
+ test-libarchive \
+ test-pull-archive-z \
+ test-admin-deploy-1 \
+ test-admin-deploy-2 \
$(NULL)
insttest_SCRIPTS = $(addprefix tests/,$(testfiles:=.sh))
g_debug ("stage of %s complete", ostree_object_to_string (checksum, objtype));
- g_assert (strcmp (checksum, expected_checksum) == 0);
+ if (strcmp (checksum, expected_checksum) != 0)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Corrupted content object; checksum expected='%s' actual='%s'",
+ expected_checksum, checksum);
+ goto out;
+ }
pull_data->n_fetched_content++;
out:
g_debug ("stage of %s complete", ostree_object_to_string (checksum, objtype));
- g_assert (strcmp (checksum, expected_checksum) == 0);
+ if (strcmp (checksum, expected_checksum) != 0)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Corrupted metadata object; checksum expected='%s' actual='%s'",
+ expected_checksum, checksum);
+ goto out;
+ }
pull_data->metadata_scan_idle = FALSE;
ot_waitable_queue_push (pull_data->metadata_objects_to_scan,
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-echo "1..34"
-
-. $(dirname $0)/libtest.sh
-
-setup_test_repository "bare"
-echo "ok setup"
-
-$OSTREE checkout test2 checkout-test2
-echo "ok checkout"
-
-$OSTREE rev-parse test2
-$OSTREE rev-parse 'test2^'
-$OSTREE rev-parse 'test2^^' 2>/dev/null && (echo 1>&2 "rev-parse test2^^ unexpectedly succeeded!"; exit 1)
-echo "ok rev-parse"
-
-$OSTREE refs > reflist
-assert_file_has_content reflist '^test2$'
-rm reflist
-
-echo "ok refs"
-
-cd checkout-test2
-assert_has_file firstfile
-assert_has_file baz/cow
-assert_file_has_content baz/cow moo
-assert_has_file baz/deeper/ohyeah
-echo "ok content"
-
-rm firstfile
-$OSTREE commit -b test2 -s delete
-
-cd $test_tmpdir
-$OSTREE checkout test2 $test_tmpdir/checkout-test2-2
-cd $test_tmpdir/checkout-test2-2
-assert_not_has_file firstfile
-assert_has_file baz/saucer
-echo "ok removal"
-
-mkdir -p a/nested/tree
-echo one > a/nested/tree/1
-echo two2 > a/nested/2
-echo 3 > a/nested/3
-touch a/4
-echo fivebaby > a/5
-touch a/6
-echo whee > 7
-mkdir -p another/nested/tree
-echo anotherone > another/nested/tree/1
-echo whee2 > another/whee
-# FIXME - remove grep for .
-$OSTREE commit -b test2 -s "Another commit"
-echo "ok commit"
-
-cd ${test_tmpdir}
-$OSTREE checkout test2 $test_tmpdir/checkout-test2-3
-cd checkout-test2-3
-assert_has_file a/nested/2
-assert_file_has_content a/nested/2 'two2'
-echo "ok stdin contents"
-
-cd ${test_tmpdir}/checkout-test2-3
-echo 4 > four
-mkdir -p yet/another/tree
-echo leaf > yet/another/tree/green
-echo helloworld > yet/message
-rm a/5
-$OSTREE commit -b test2 -s "Current directory"
-echo "ok cwd commit"
-
-cd ${test_tmpdir}
-$OSTREE checkout test2 $test_tmpdir/checkout-test2-4
-cd checkout-test2-4
-assert_file_has_content yet/another/tree/green 'leaf'
-assert_file_has_content four '4'
-echo "ok cwd contents"
-
-cd ${test_tmpdir}
-$OSTREE diff test2^ test2 > diff-test2
-assert_file_has_content diff-test2 'D */a/5'
-assert_file_has_content diff-test2 'A */yet$'
-assert_file_has_content diff-test2 'A */yet/message$'
-assert_file_has_content diff-test2 'A */yet/another/tree/green$'
-echo "ok diff revisions"
-
-cd ${test_tmpdir}/checkout-test2-4
-echo afile > oh-look-a-file
-$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
-rm oh-look-a-file
-cd ${test_tmpdir}
-assert_file_has_content diff-test2-2 'A *oh-look-a-file$'
-echo "ok diff cwd"
-
-cd ${test_tmpdir}/checkout-test2-4
-rm four
-mkdir four
-touch four/other
-$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
-cd ${test_tmpdir}
-assert_file_has_content diff-test2-2 'M */four$'
-echo "ok diff file changing type"
-
-cd ${test_tmpdir}/checkout-test2-4
-echo afile > oh-look-a-file
-cat > ${test_tmpdir}/ostree-commit-metadata <<EOF
-{'origin': <'http://example.com'>, 'buildid': <@u 42>}
-EOF
-$OSTREE commit -b test2 -s "Metadata test" --metadata-variant-text=${test_tmpdir}/ostree-commit-metadata
-echo "ok metadata commit"
-
-cd ${test_tmpdir}
-rm ostree-commit-metadata
-$OSTREE show test2 > ${test_tmpdir}/show
-assert_file_has_content ${test_tmpdir}/show 'example.com'
-assert_file_has_content ${test_tmpdir}/show 'buildid'
-echo "ok metadata content"
-
-cd ${test_tmpdir}
-mkdir repo2
-${CMD_PREFIX} ostree --repo=repo2 init
-${CMD_PREFIX} ostree --repo=repo2 pull-local repo
-echo "ok pull-local"
-
-cd ${test_tmpdir}
-${CMD_PREFIX} ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
-cd test2-checkout-from-local-clone
-assert_file_has_content yet/another/tree/green 'leaf'
-echo "ok local clone checkout"
-
-$OSTREE checkout -U test2 checkout-user-test2
-echo "ok user checkout"
-
-$OSTREE commit -b test2 -s "Another commit" --tree=ref=test2
-echo "ok commit from ref"
-
-$OSTREE commit -b trees/test2 -s 'ref with / in it' --tree=ref=test2
-echo "ok commit ref with /"
-
-old_rev=$($OSTREE rev-parse test2)
-$OSTREE commit --skip-if-unchanged -b test2 -s 'should not be committed' --tree=ref=test2
-new_rev=$($OSTREE rev-parse test2)
-assert_streq "${old_rev}" "${new_rev}"
-echo "ok commit --skip-if-unchanged"
-
-$OSTREE commit -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR --add-metadata-string=KITTENS=CUTE --tree=ref=test2
-$OSTREE show test2 > test2-commit-text
-assert_file_has_content test2-commit-text "'FOO'.*'BAR'"
-assert_file_has_content test2-commit-text "'KITTENS'.*'CUTE'"
-echo "ok metadata commit with strings"
-
-cd ${test_tmpdir}/checkout-test2-4
-$OSTREE commit -b test2 -s "no xattrs" --no-xattrs
-echo "ok commit with no xattrs"
-
-cd ${test_tmpdir}
-cat > test-statoverride.txt <<EOF
-+2048 /a/nested/3
-EOF
-cd ${test_tmpdir}/checkout-test2-4
-$OSTREE commit -b test2 -s "with statoverride" --statoverride=../test-statoverride.txt
-echo "ok commit statoverridde"
-
-cd ${test_tmpdir}
-$OSTREE prune
-echo "ok prune didn't fail"
-
-cd ${test_tmpdir}
-$OSTREE cat test2 /yet/another/tree/green > greenfile-contents
-assert_file_has_content greenfile-contents "leaf"
-echo "ok cat-file"
-
-cd ${test_tmpdir}
-$OSTREE checkout --subpath /yet/another test2 checkout-test2-subpath
-cd checkout-test2-subpath
-assert_file_has_content tree/green "leaf"
-echo "ok checkout subpath"
-
-cd ${test_tmpdir}
-$OSTREE checkout --union test2 checkout-test2-union
-find checkout-test2-union | wc -l > union-files-count
-$OSTREE checkout --union test2 checkout-test2-union
-find checkout-test2-union | wc -l > union-files-count.new
-cmp union-files-count{,.new}
-cd checkout-test2-union
-assert_file_has_content ./yet/another/tree/green "leaf"
-echo "ok checkout union 1"
-
-cd ${test_tmpdir}
-rm -rf shadow-repo
-mkdir shadow-repo
-${CMD_PREFIX} ostree --repo=shadow-repo init
-${CMD_PREFIX} ostree --repo=shadow-repo config set core.parent $(pwd)/repo
-rm -rf test2-checkout
-parent_rev_test2=$(ostree --repo=repo rev-parse test2)
-${CMD_PREFIX} ostree --repo=shadow-repo checkout "${parent_rev_test2}" test2-checkout
-echo "ok checkout from shadow repo"
-
-cd ${test_tmpdir}
-rm -f expected-fail
-$OSTREE checkout test2 --subpath /enoent 2>/dev/null || touch expected-fail
-assert_has_file expected-fail
-echo "ok subdir enoent"
-
-cd ${test_tmpdir}
-$OSTREE checkout test2 --allow-noent --subpath /enoent 2>/dev/null
-echo "ok subdir noent"
-
-cd ${test_tmpdir}
-mkdir repo3
-${CMD_PREFIX} ostree --repo=repo3 init
-${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2
-ostree --repo=repo3 rev-parse aremote/test2
-echo "ok pull-local with --remote arg"
-
-cd ${test_tmpdir}
-ostree --repo=repo3 prune
-find repo3/objects -name '*.commit' > objlist-before-prune
-rm repo3/refs/heads/* repo3/refs/remotes/* -rf
-ostree --repo=repo3 prune --refs-only
-find repo3/objects -name '*.commit' > objlist-after-prune
-if cmp -s objlist-before-prune objlist-after-prune; then
- echo "Prune didn't delete anything!"; exit 1
-fi
-rm repo3 objlist-before-prune objlist-after-prune -rf
-echo "ok prune"
-
-cd ${test_tmpdir}
-$OSTREE commit -b test3 -s "Another commit" --tree=ref=test2
-ostree --repo=repo refs > reflist
-assert_file_has_content reflist '^test3$'
-ostree --repo=repo refs --delete test3
-ostree --repo=repo refs > reflist
-assert_not_file_has_content reflist '^test3$'
-echo "ok reflist --delete"
-
-
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo '1..11'
-
-setup_test_repository "archive"
-echo "ok setup"
-
-. ${SRCDIR}/archive-test.sh
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo '1..11'
-
-setup_test_repository "archive-z2"
-echo "ok setup"
-
-. ${SRCDIR}/archive-test.sh
-
-cd ${test_tmpdir}
-mkdir repo2
-${CMD_PREFIX} ostree --repo=repo2 init
-${CMD_PREFIX} ostree --repo=repo2 remote add aremote file://$(pwd)/repo test2
-ostree --repo=repo2 pull aremote
-ostree --repo=repo2 rev-parse aremote/test2
-ostree --repo=repo2 fsck
-echo "ok pull with from file:/// uri"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo "1..1"
-
-setup_test_repository "bare"
-$OSTREE log test2 > $test_tmpdir/log.txt
-assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
-assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
-echo "ok log"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo '1..2'
-
-setup_test_repository "bare"
-$OSTREE remote add origin http://example.com/ostree/gnome
-echo "ok remote add"
-assert_file_has_content $test_tmpdir/repo/config "example.com"
-echo "ok config"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-echo "1..1"
-
-. $(dirname $0)/libtest.sh
-
-setup_test_repository "bare"
-$OSTREE checkout test2 checkout-test2
-cd checkout-test2
-chmod o+x firstfile
-$OSTREE fsck -q 2>/dev/null && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
-chmod o-x firstfile
-$OSTREE fsck -q
-
-echo "ok chmod"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-if ! ostree --version | grep -q -e '\+libarchive'; then
- exit 77
-fi
-
-echo "1..7"
-
-. $(dirname $0)/libtest.sh
-
-setup_test_repository "bare"
-cd ${test_tmpdir}
-mkdir foo
-cd foo
-echo hi > hi
-ln -s hi hello
-mkdir subdir
-echo contents > subdir/more
-mkdir subdir/1
-touch subdir/1/empty
-mkdir subdir/2
-touch subdir/2/empty
-echo not > subdir/2/notempty
-
-tar -c -z -f ../foo.tar.gz .
-cd ..
-$OSTREE commit -s "from tar" -b test-tar --tree=tar=foo.tar.gz
-echo "ok tar commit"
-
-cd ${test_tmpdir}
-$OSTREE checkout test-tar test-tar-checkout
-cd test-tar-checkout
-assert_file_has_content hi hi
-assert_file_has_content hello hi
-assert_file_has_content subdir/more contents
-assert_has_file subdir/1/empty
-assert_has_file subdir/2/empty
-cd ${test_tmpdir}
-rm -rf test-tar-checkout
-echo "ok tar contents"
-
-cd ${test_tmpdir}
-mkdir hardlinktest
-cd hardlinktest
-echo other > otherfile
-echo foo1 > foo
-ln foo bar
-tar czf ${test_tmpdir}/hardlinktest.tar.gz .
-cd ${test_tmpdir}
-$OSTREE commit -s 'hardlinks' -b test-hardlinks --tree=tar=hardlinktest.tar.gz
-rm -rf hardlinktest
-echo "ok hardlink commit"
-
-cd ${test_tmpdir}
-$OSTREE checkout test-hardlinks test-hardlinks-checkout
-cd test-hardlinks-checkout
-assert_file_has_content foo foo1
-assert_file_has_content bar foo1
-echo "ok hardlink contents"
-
-cd ${test_tmpdir}
-mkdir multicommit-files
-cd multicommit-files
-mkdir -p files1/subdir files2/subdir
-echo "to be overwritten file" > files1/testfile
-echo "not overwritten" > files1/otherfile
-echo "overwriting file" > files2/testfile
-ln -s "to-be-overwritten-symlink" files1/testsymlink
-ln -s "overwriting-symlink" files2/testsymlink
-ln -s "not overwriting symlink" files2/ohersymlink
-echo "original" > files1/subdir/original
-echo "new" > files2/subdir/new
-
-tar -c -C files1 -z -f files1.tar.gz .
-tar -c -C files2 -z -f files2.tar.gz .
-
-$OSTREE commit -s 'multi tar' -b multicommit --tree=tar=files1.tar.gz --tree=tar=files2.tar.gz
-echo "ok tar multicommit"
-
-cd ${test_tmpdir}
-$OSTREE checkout multicommit multicommit-checkout
-cd multicommit-checkout
-assert_file_has_content testfile "overwriting file"
-assert_file_has_content otherfile "not overwritten"
-assert_file_has_content subdir/original "original"
-assert_file_has_content subdir/new "new"
-echo "ok tar multicommit contents"
-
-cd ${test_tmpdir}/multicommit-files
-tar -c -C files1 -z -f partial.tar.gz subdir/original
-$OSTREE commit -s 'partial' -b partial --tar-autocreate-parents --tree=tar=partial.tar.gz
-echo "ok tar partial commit"
-
-cd ${test_tmpdir}
-$OSTREE checkout partial partial-checkout
-cd partial-checkout
-assert_file_has_content subdir/original "original"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-setup_fake_remote_repo1 "archive-z2"
-
-echo '1..2'
-
-. ${SRCDIR}/pull-test.sh
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo "1..1"
-
-setup_os_repository "archive-z2"
-
-echo "ok setup"
-
-echo "1..7"
-
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-export rev
-# This initial deployment gets kicked off with some kernel arguments
-ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
-
-echo "ok deploy command"
-
-assert_not_has_dir sysroot/boot/loader.0
-assert_has_dir sysroot/boot/loader.1
-assert_has_dir sysroot/ostree/boot.1.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* root=LABEL=MOO'
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* quiet'
-assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-
-echo "ok layout"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Need a new bootversion, sine we now have two deployments
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_dir sysroot/ostree/boot.0.1
-assert_not_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.1.0
-assert_not_has_dir sysroot/ostree/boot.1.1
-# Ensure we propagated kernel arguments from previous deployment
-assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* root=LABEL=MOO'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-
-echo "ok second deploy"
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-# Keep the same bootversion
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-# But swap subbootversion
-assert_has_dir sysroot/ostree/boot.0.0
-assert_not_has_dir sysroot/ostree/boot.0.1
-
-echo "ok third deploy (swap)"
-
-ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
-assert_not_has_dir sysroot/boot/loader.0
-assert_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
-assert_has_file sysroot/boot/loader/entries/ostree-otheros-${rev}-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
-
-echo "ok independent deploy"
-
-ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_has_dir sysroot/boot/loader.0
-assert_not_has_dir sysroot/boot/loader.1
-assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
-assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-2.conf
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
-
-echo "ok fourth deploy (retain)"
-
-echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file
-rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
-ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
-ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
-linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
-test "${linktarget}" = /ENOENT
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
-assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
-
-echo "ok deploy with modified /etc"
-
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
-export newrev
-assert_not_streq ${rev} ${newrev}
-
-ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-# New files in /usr/etc
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
-# And persist /etc changes from before
-assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
-
-echo "ok upgrade bare"
-
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
-ostree admin --sysroot=sysroot upgrade --os=testos
-rev=${newrev}
-newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-assert_not_streq ${rev} ${newrev}
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-
-echo "ok upgrade"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-
-. $(dirname $0)/libtest.sh
-
-echo "1..1"
-
-setup_os_repository "archive-z2"
-
-echo "ok setup"
-
-echo "1..2"
-
-ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
-rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-export rev
-# This initial deployment gets kicked off with some kernel arguments
-ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
-assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
-
-echo "ok deploy command"
-
-# Commit + upgrade twice, so that we'll rotate out the original deployment
-orig_bootcsum=${bootcsum}
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
-ostree admin --sysroot=sysroot upgrade --os=testos
-os_repository_new_commit
-ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
-ostree admin --sysroot=sysroot upgrade --os=testos
-
-rev=${newrev}
-newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
-assert_not_streq ${rev} ${newrev}
-assert_not_streq ${orig_bootcsum} ${bootcsum}
-assert_not_has_dir sysroot/boot/ostree/testos-${orig_bootcsum}
-assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
-assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
-
-echo "ok deploy and GC /boot"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo "1..1"
+
+setup_os_repository "archive-z2"
+
+echo "ok setup"
+
+echo "1..7"
+
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+export rev
+# This initial deployment gets kicked off with some kernel arguments
+ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
+
+echo "ok deploy command"
+
+assert_not_has_dir sysroot/boot/loader.0
+assert_has_dir sysroot/boot/loader.1
+assert_has_dir sysroot/ostree/boot.1.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* root=LABEL=MOO'
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* quiet'
+assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
+
+echo "ok layout"
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+# Need a new bootversion, sine we now have two deployments
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+assert_has_dir sysroot/ostree/boot.0.1
+assert_not_has_dir sysroot/ostree/boot.0.0
+assert_not_has_dir sysroot/ostree/boot.1.0
+assert_not_has_dir sysroot/ostree/boot.1.1
+# Ensure we propagated kernel arguments from previous deployment
+assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* root=LABEL=MOO'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
+
+echo "ok second deploy"
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+# Keep the same bootversion
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+# But swap subbootversion
+assert_has_dir sysroot/ostree/boot.0.0
+assert_not_has_dir sysroot/ostree/boot.0.1
+
+echo "ok third deploy (swap)"
+
+ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime
+assert_not_has_dir sysroot/boot/loader.0
+assert_has_dir sysroot/boot/loader.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
+assert_has_file sysroot/boot/loader/entries/ostree-otheros-${rev}-0.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+
+echo "ok independent deploy"
+
+ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_has_dir sysroot/boot/loader.0
+assert_not_has_dir sysroot/boot/loader.1
+assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
+assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-2.conf
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
+
+echo "ok fourth deploy (retain)"
+
+echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file
+rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
+ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
+ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
+linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
+test "${linktarget}" = /ENOENT
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local config file'
+assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
+
+echo "ok deploy with modified /etc"
+
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
+export newrev
+assert_not_streq ${rev} ${newrev}
+
+ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+# New files in /usr/etc
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
+# And persist /etc changes from before
+assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
+
+echo "ok upgrade bare"
+
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot upgrade --os=testos
+rev=${newrev}
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+assert_not_streq ${rev} ${newrev}
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+
+echo "ok upgrade"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo "1..1"
+
+setup_os_repository "archive-z2"
+
+echo "ok setup"
+
+echo "1..2"
+
+ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
+rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+export rev
+# This initial deployment gets kicked off with some kernel arguments
+ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
+assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
+
+echo "ok deploy command"
+
+# Commit + upgrade twice, so that we'll rotate out the original deployment
+orig_bootcsum=${bootcsum}
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot upgrade --os=testos
+os_repository_new_commit
+ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot upgrade --os=testos
+
+rev=${newrev}
+newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
+assert_not_streq ${rev} ${newrev}
+assert_not_streq ${orig_bootcsum} ${bootcsum}
+assert_not_has_dir sysroot/boot/ostree/testos-${orig_bootcsum}
+assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
+assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+
+echo "ok deploy and GC /boot"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo '1..11'
+
+setup_test_repository "archive"
+echo "ok setup"
+
+. ${SRCDIR}/archive-test.sh
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo '1..11'
+
+setup_test_repository "archive-z2"
+echo "ok setup"
+
+. ${SRCDIR}/archive-test.sh
+
+cd ${test_tmpdir}
+mkdir repo2
+${CMD_PREFIX} ostree --repo=repo2 init
+${CMD_PREFIX} ostree --repo=repo2 remote add aremote file://$(pwd)/repo test2
+ostree --repo=repo2 pull aremote
+ostree --repo=repo2 rev-parse aremote/test2
+ostree --repo=repo2 fsck
+echo "ok pull with from file:/// uri"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+echo "1..34"
+
+. $(dirname $0)/libtest.sh
+
+setup_test_repository "bare"
+echo "ok setup"
+
+$OSTREE checkout test2 checkout-test2
+echo "ok checkout"
+
+$OSTREE rev-parse test2
+$OSTREE rev-parse 'test2^'
+$OSTREE rev-parse 'test2^^' 2>/dev/null && (echo 1>&2 "rev-parse test2^^ unexpectedly succeeded!"; exit 1)
+echo "ok rev-parse"
+
+$OSTREE refs > reflist
+assert_file_has_content reflist '^test2$'
+rm reflist
+
+echo "ok refs"
+
+cd checkout-test2
+assert_has_file firstfile
+assert_has_file baz/cow
+assert_file_has_content baz/cow moo
+assert_has_file baz/deeper/ohyeah
+echo "ok content"
+
+rm firstfile
+$OSTREE commit -b test2 -s delete
+
+cd $test_tmpdir
+$OSTREE checkout test2 $test_tmpdir/checkout-test2-2
+cd $test_tmpdir/checkout-test2-2
+assert_not_has_file firstfile
+assert_has_file baz/saucer
+echo "ok removal"
+
+mkdir -p a/nested/tree
+echo one > a/nested/tree/1
+echo two2 > a/nested/2
+echo 3 > a/nested/3
+touch a/4
+echo fivebaby > a/5
+touch a/6
+echo whee > 7
+mkdir -p another/nested/tree
+echo anotherone > another/nested/tree/1
+echo whee2 > another/whee
+# FIXME - remove grep for .
+$OSTREE commit -b test2 -s "Another commit"
+echo "ok commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test2 $test_tmpdir/checkout-test2-3
+cd checkout-test2-3
+assert_has_file a/nested/2
+assert_file_has_content a/nested/2 'two2'
+echo "ok stdin contents"
+
+cd ${test_tmpdir}/checkout-test2-3
+echo 4 > four
+mkdir -p yet/another/tree
+echo leaf > yet/another/tree/green
+echo helloworld > yet/message
+rm a/5
+$OSTREE commit -b test2 -s "Current directory"
+echo "ok cwd commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test2 $test_tmpdir/checkout-test2-4
+cd checkout-test2-4
+assert_file_has_content yet/another/tree/green 'leaf'
+assert_file_has_content four '4'
+echo "ok cwd contents"
+
+cd ${test_tmpdir}
+$OSTREE diff test2^ test2 > diff-test2
+assert_file_has_content diff-test2 'D */a/5'
+assert_file_has_content diff-test2 'A */yet$'
+assert_file_has_content diff-test2 'A */yet/message$'
+assert_file_has_content diff-test2 'A */yet/another/tree/green$'
+echo "ok diff revisions"
+
+cd ${test_tmpdir}/checkout-test2-4
+echo afile > oh-look-a-file
+$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
+rm oh-look-a-file
+cd ${test_tmpdir}
+assert_file_has_content diff-test2-2 'A *oh-look-a-file$'
+echo "ok diff cwd"
+
+cd ${test_tmpdir}/checkout-test2-4
+rm four
+mkdir four
+touch four/other
+$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
+cd ${test_tmpdir}
+assert_file_has_content diff-test2-2 'M */four$'
+echo "ok diff file changing type"
+
+cd ${test_tmpdir}/checkout-test2-4
+echo afile > oh-look-a-file
+cat > ${test_tmpdir}/ostree-commit-metadata <<EOF
+{'origin': <'http://example.com'>, 'buildid': <@u 42>}
+EOF
+$OSTREE commit -b test2 -s "Metadata test" --metadata-variant-text=${test_tmpdir}/ostree-commit-metadata
+echo "ok metadata commit"
+
+cd ${test_tmpdir}
+rm ostree-commit-metadata
+$OSTREE show test2 > ${test_tmpdir}/show
+assert_file_has_content ${test_tmpdir}/show 'example.com'
+assert_file_has_content ${test_tmpdir}/show 'buildid'
+echo "ok metadata content"
+
+cd ${test_tmpdir}
+mkdir repo2
+${CMD_PREFIX} ostree --repo=repo2 init
+${CMD_PREFIX} ostree --repo=repo2 pull-local repo
+echo "ok pull-local"
+
+cd ${test_tmpdir}
+${CMD_PREFIX} ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
+cd test2-checkout-from-local-clone
+assert_file_has_content yet/another/tree/green 'leaf'
+echo "ok local clone checkout"
+
+$OSTREE checkout -U test2 checkout-user-test2
+echo "ok user checkout"
+
+$OSTREE commit -b test2 -s "Another commit" --tree=ref=test2
+echo "ok commit from ref"
+
+$OSTREE commit -b trees/test2 -s 'ref with / in it' --tree=ref=test2
+echo "ok commit ref with /"
+
+old_rev=$($OSTREE rev-parse test2)
+$OSTREE commit --skip-if-unchanged -b test2 -s 'should not be committed' --tree=ref=test2
+new_rev=$($OSTREE rev-parse test2)
+assert_streq "${old_rev}" "${new_rev}"
+echo "ok commit --skip-if-unchanged"
+
+$OSTREE commit -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR --add-metadata-string=KITTENS=CUTE --tree=ref=test2
+$OSTREE show test2 > test2-commit-text
+assert_file_has_content test2-commit-text "'FOO'.*'BAR'"
+assert_file_has_content test2-commit-text "'KITTENS'.*'CUTE'"
+echo "ok metadata commit with strings"
+
+cd ${test_tmpdir}/checkout-test2-4
+$OSTREE commit -b test2 -s "no xattrs" --no-xattrs
+echo "ok commit with no xattrs"
+
+cd ${test_tmpdir}
+cat > test-statoverride.txt <<EOF
++2048 /a/nested/3
+EOF
+cd ${test_tmpdir}/checkout-test2-4
+$OSTREE commit -b test2 -s "with statoverride" --statoverride=../test-statoverride.txt
+echo "ok commit statoverridde"
+
+cd ${test_tmpdir}
+$OSTREE prune
+echo "ok prune didn't fail"
+
+cd ${test_tmpdir}
+$OSTREE cat test2 /yet/another/tree/green > greenfile-contents
+assert_file_has_content greenfile-contents "leaf"
+echo "ok cat-file"
+
+cd ${test_tmpdir}
+$OSTREE checkout --subpath /yet/another test2 checkout-test2-subpath
+cd checkout-test2-subpath
+assert_file_has_content tree/green "leaf"
+echo "ok checkout subpath"
+
+cd ${test_tmpdir}
+$OSTREE checkout --union test2 checkout-test2-union
+find checkout-test2-union | wc -l > union-files-count
+$OSTREE checkout --union test2 checkout-test2-union
+find checkout-test2-union | wc -l > union-files-count.new
+cmp union-files-count{,.new}
+cd checkout-test2-union
+assert_file_has_content ./yet/another/tree/green "leaf"
+echo "ok checkout union 1"
+
+cd ${test_tmpdir}
+rm -rf shadow-repo
+mkdir shadow-repo
+${CMD_PREFIX} ostree --repo=shadow-repo init
+${CMD_PREFIX} ostree --repo=shadow-repo config set core.parent $(pwd)/repo
+rm -rf test2-checkout
+parent_rev_test2=$(ostree --repo=repo rev-parse test2)
+${CMD_PREFIX} ostree --repo=shadow-repo checkout "${parent_rev_test2}" test2-checkout
+echo "ok checkout from shadow repo"
+
+cd ${test_tmpdir}
+rm -f expected-fail
+$OSTREE checkout test2 --subpath /enoent 2>/dev/null || touch expected-fail
+assert_has_file expected-fail
+echo "ok subdir enoent"
+
+cd ${test_tmpdir}
+$OSTREE checkout test2 --allow-noent --subpath /enoent 2>/dev/null
+echo "ok subdir noent"
+
+cd ${test_tmpdir}
+mkdir repo3
+${CMD_PREFIX} ostree --repo=repo3 init
+${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2
+ostree --repo=repo3 rev-parse aremote/test2
+echo "ok pull-local with --remote arg"
+
+cd ${test_tmpdir}
+ostree --repo=repo3 prune
+find repo3/objects -name '*.commit' > objlist-before-prune
+rm repo3/refs/heads/* repo3/refs/remotes/* -rf
+ostree --repo=repo3 prune --refs-only
+find repo3/objects -name '*.commit' > objlist-after-prune
+if cmp -s objlist-before-prune objlist-after-prune; then
+ echo "Prune didn't delete anything!"; exit 1
+fi
+rm repo3 objlist-before-prune objlist-after-prune -rf
+echo "ok prune"
+
+cd ${test_tmpdir}
+$OSTREE commit -b test3 -s "Another commit" --tree=ref=test2
+ostree --repo=repo refs > reflist
+assert_file_has_content reflist '^test3$'
+ostree --repo=repo refs --delete test3
+ostree --repo=repo refs > reflist
+assert_not_file_has_content reflist '^test3$'
+echo "ok reflist --delete"
+
+
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+echo "1..1"
+
+. $(dirname $0)/libtest.sh
+
+setup_test_repository "bare"
+$OSTREE checkout test2 checkout-test2
+cd checkout-test2
+chmod o+x firstfile
+$OSTREE fsck -q 2>/dev/null && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
+chmod o-x firstfile
+$OSTREE fsck -q
+
+echo "ok chmod"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+if ! ostree --version | grep -q -e '\+libarchive'; then
+ exit 77
+fi
+
+echo "1..7"
+
+. $(dirname $0)/libtest.sh
+
+setup_test_repository "bare"
+cd ${test_tmpdir}
+mkdir foo
+cd foo
+echo hi > hi
+ln -s hi hello
+mkdir subdir
+echo contents > subdir/more
+mkdir subdir/1
+touch subdir/1/empty
+mkdir subdir/2
+touch subdir/2/empty
+echo not > subdir/2/notempty
+
+tar -c -z -f ../foo.tar.gz .
+cd ..
+$OSTREE commit -s "from tar" -b test-tar --tree=tar=foo.tar.gz
+echo "ok tar commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test-tar test-tar-checkout
+cd test-tar-checkout
+assert_file_has_content hi hi
+assert_file_has_content hello hi
+assert_file_has_content subdir/more contents
+assert_has_file subdir/1/empty
+assert_has_file subdir/2/empty
+cd ${test_tmpdir}
+rm -rf test-tar-checkout
+echo "ok tar contents"
+
+cd ${test_tmpdir}
+mkdir hardlinktest
+cd hardlinktest
+echo other > otherfile
+echo foo1 > foo
+ln foo bar
+tar czf ${test_tmpdir}/hardlinktest.tar.gz .
+cd ${test_tmpdir}
+$OSTREE commit -s 'hardlinks' -b test-hardlinks --tree=tar=hardlinktest.tar.gz
+rm -rf hardlinktest
+echo "ok hardlink commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test-hardlinks test-hardlinks-checkout
+cd test-hardlinks-checkout
+assert_file_has_content foo foo1
+assert_file_has_content bar foo1
+echo "ok hardlink contents"
+
+cd ${test_tmpdir}
+mkdir multicommit-files
+cd multicommit-files
+mkdir -p files1/subdir files2/subdir
+echo "to be overwritten file" > files1/testfile
+echo "not overwritten" > files1/otherfile
+echo "overwriting file" > files2/testfile
+ln -s "to-be-overwritten-symlink" files1/testsymlink
+ln -s "overwriting-symlink" files2/testsymlink
+ln -s "not overwriting symlink" files2/ohersymlink
+echo "original" > files1/subdir/original
+echo "new" > files2/subdir/new
+
+tar -c -C files1 -z -f files1.tar.gz .
+tar -c -C files2 -z -f files2.tar.gz .
+
+$OSTREE commit -s 'multi tar' -b multicommit --tree=tar=files1.tar.gz --tree=tar=files2.tar.gz
+echo "ok tar multicommit"
+
+cd ${test_tmpdir}
+$OSTREE checkout multicommit multicommit-checkout
+cd multicommit-checkout
+assert_file_has_content testfile "overwriting file"
+assert_file_has_content otherfile "not overwritten"
+assert_file_has_content subdir/original "original"
+assert_file_has_content subdir/new "new"
+echo "ok tar multicommit contents"
+
+cd ${test_tmpdir}/multicommit-files
+tar -c -C files1 -z -f partial.tar.gz subdir/original
+$OSTREE commit -s 'partial' -b partial --tar-autocreate-parents --tree=tar=partial.tar.gz
+echo "ok tar partial commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout partial partial-checkout
+cd partial-checkout
+assert_file_has_content subdir/original "original"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo "1..1"
+
+setup_test_repository "bare"
+$OSTREE log test2 > $test_tmpdir/log.txt
+assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
+assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
+echo "ok log"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+setup_fake_remote_repo1 "archive-z2"
+
+echo '1..2'
+
+. ${SRCDIR}/pull-test.sh
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+
+. $(dirname $0)/libtest.sh
+
+echo '1..2'
+
+setup_test_repository "bare"
+$OSTREE remote add origin http://example.com/ostree/gnome
+echo "ok remote add"
+assert_file_has_content $test_tmpdir/repo/config "example.com"
+echo "ok config"